import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/normal/Home.vue'
import Login from '../views/normal/Login.vue'
import Register from '../views/normal/Register.vue'
import Reset from '../views/normal/Reset'
import AdminHome from '../views/admin/adminHome'
import AdminLogin from '../views/admin/adminLogin'
import DoctorInfo from '../views/normal/userInfo/doctorInfo.vue'

Vue.use(VueRouter)


const routes = [
    {
      path: '/',
      name: 'Default',
      redirect: '/home',
      component: Home
    },
    {
    path: '/home',
    redirect: '/index',
    component: Home,
    name: 'Home',
    children: [
      {
        path: '/index',
        name: 'Index',
        meta :{
          title: '首页'
        },
        component: ()=> import("../views/normal/Index.vue")
      },{
        path: '/doctorInfo',
        name: 'doctorInfo',
        meta: {
          title: '医生信息'
        },
        component: ()=> import("../views/normal/userInfo/doctorInfo")
      },{
        path: '/doctorInfo/waitingQueue',
        name: 'waitingQueue',
        meta: {
          title: '医生候诊信息'
        },
        component: ()=> import("../views/normal/waitingQueue/waitingQueue")
      },{
        path: '/userInfo',
        name: 'userInfo',
        meta: {
          title: '用户信息'
        },
        component: ()=> import("../views/normal/userInfo/userInfo")
      },{
        path: '/inquiryHistory',
        name: 'inquiryHistory',
        meta: {
          title: '会诊记录'
        },
        component: ()=> import("../views/normal/userInfo/inquiryHistory")
      }
    ]
  }, {
    path: '/login',
    name: 'Login',
    component: Login
  }, {
    path: '/register',
    name: 'Register',
    component: Register
  }, {//设置重置密码页

    path: '/reset',
    name: 'Reset',
    component: Reset,
    children: [
      {
        //选择方式
        path: '/reset/resetMethod',
        name: 'ResetMethod',
        component: ()=> import('../views/normal/resetPassword/resetMethod.vue')
      },{
        //重置密码
        path: '/reset/resetPassword',
        name: 'resetPassword',
        component: ()=> import('../views/normal/resetPassword/resetPassword.vue')

      },{
        //短信重置密码
        path: '/reset/resetByPhone',
        name: 'resetByPhone',
        component: ()=> import('../views/normal/resetPassword/resetByPhone')

      },{
        //邮箱重置密码
        path: '/reset/resetByEmail',
        name: 'resetByEmail',
        component: ()=> import('../views/normal/resetPassword/resetByEmail')

      }
    ]
  } ,{
    //医生客户端
    path: '/talkRoom/doctor',
    name: 'doctorClient',
    component: ()=>import('../views/normal/talkRoom/doctorClient')
  },{
    //患者客户端
    path: '/talkRoom/patient',
    name: 'patientClient',
    component: ()=>import('../views/normal/talkRoom/patientClient')

  },{//管理员部份
    path: '/adminLogin',
    name: 'adminLogin',
    component: AdminLogin
  },
  {
    path: '/adminHome',
    name: 'adminHome',
    component: AdminHome,
    children: [
      {
        path: '/admin',
        name: 'admin',
        meta :{
          title: '管理员首页'
        },
        component: () => import('../views/admin/admin.vue')
      },{
        path: '/admin/adminCentral',
        name: 'adminCentral',
        meta :{
          title: '个人中心'
        },
        component: () => import('../views/admin/adminCentral')
      }, {
        path: '/admin/doctorManagement',
        name: 'doctorManagement',
        meta :{
          title: '医生信息管理'
        },
        component: () => import('../views/admin/management/doctorManagement')
      },{
        path: '/admin/userManagement',
        name: 'userManagement',
        meta :{
          title: '普通用户管理'
        },
        component: () => import('../views/admin/management/userManagement')
      },{
        path: '/admin/patientManagement',
        name: 'patientManagement',
        meta :{
          title: '患者信息管理'
        },
        component: () => import('../views/admin/management/patientManagement')
      },{
        path: '/admin/inquiryManagement',
        name: 'inquiryManagement',
        meta :{
          title: '会诊信息管理'
        },
        component: () => import('../views/admin/management/inquiryManagement')
      },{
        path: '/admin/waitingQueueManagement',
        name: 'waitingManagement',
        meta :{
          title: '候诊信息管理'
        },
        component: () => import('../views/admin/management/waitingQueueManagement')
      },{
        path: '/admin/sysInfoManagement',
        name: 'sysInfoManagement',
        meta :{
          title: '系统信息管理'
        },
        component: () => import('../views/admin/management/sysInfoManagement')
      },{
        path: '/admin/adminLogManagement',
        name: 'adminLogManagement',
        meta :{
          title: '日志信息管理'
        },
        component: () => import('../views/admin/management/adminLogManagement')
      }
    ]
  },
  {
    path: '/patientClient',
    name: 'patientClient',
    component: ()=> import('../views/normal/talkRoom/patientClient')
  },
  {
    path: '/media',
    name: 'media',
    component: ()=> import('../views/normal/talkRoom/media')
  }
  // {
  //   path: '/about',
  //   name: 'About',
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  // }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
